<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
	request.setCharacterEncoding("UTF-8");
	String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    String date= format.format(new Date());
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css" >
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">

</head>
<style type="text/css">
	.seachform li label{line-height: 45px;color: #444444}
	.scinput{line-height: 10px;margin-top: 5px}
	.scinput1{margin-top: 5px;height: 30px;}
	.scbtn{background: #57a0ff;border-radius:20px;width: 110px;margin-top: 4px;height: 35px;outline:none;}
	.scbtn2{height: 20px;background: #57a0ff;border-radius:20px;width: 50px;color: #fff;display: none;}

	thead {background: #f2f2f2}
	tbody tr:nth-child(even) {}
	.tablelist th{height: 45px;padding-left: 30px;text-align: center;background: none;border-bottom: none;}
	.tablelist td{border-right:none;padding-left: 30px;text-align: center;}
	tbody tr{height: 38px}
	.check{padding-left: 0px}
	a{cursor: pointer;}
	.placeul a{color: #444444}
	.success td{border:1px solid #dddee6;}
	.seachform{display: block; list-style-type: disc; -webkit-margin-before: 1em; -webkit-margin-after: 1em; -webkit-margin-start: 0px; -webkit-margin-end: 0px; -webkit-padding-start: 40px;}
	.seachform { display: block; margin: 0; padding: 0; list-style: none; border-bottom:none }
	.rightinfo { padding: 8px; font-size: 12px}
	/* * { border: 0; margin: 0; padding: 0; } */
	.scbtn { background: #57a0ff; border-radius: 20px; width: 110px; margin-top: 4px; height: 35px; outline: none;border: 0 }
	.scbtn { width: 95px; height: 34px;  font-size: 14px; font-weight: bold; color: #fff; cursor: pointer; border-radius: 50px; behavior: url(js/pie.htc);}
	.scinput { width: 150px; height: 30px; line-height: 30px; border-top: solid 1px #a7b5bc; border-left: solid 1px #a7b5bc; border-right: solid 1px #ced9df; border-bottom: solid 1px #ced9df; background: url(../images/inputbg.gif) repeat-x; text-indent: 10px; }
	a, a:focus { text-decoration: none; color: #000; outline: none; blr: expression(this.onFocus=this.blur()); }
	.seachform li { float: left; margin-right: 15px; }
	li { display: block; margin: 0; padding: 0; list-style: none; }
	.scinput1 { width: 150px; height: 30px; line-height: 30px; border-top: solid 1px #a7b5bc; border-left: solid 1px #a7b5bc; border-right: solid 1px #ced9df; border-bottom: solid 1px #ced9df; background: url(../images/inputbg.gif) repeat-x; text-indent: 10px; }
	.placeul li:last-child { background: none; }
	.seachform li label{margin-right: 10px}
	.placeul li { float: left; line-height: 40px; padding-left: 7px; padding-right: 12px; background: url(../images/rlist.gif) no-repeat right;font-size: 9px }
	ul{border-bottom: none;}
	.findBtn, .findBtn1, .findBtn2:hover {
		background: -webkit-linear-gradient(top, #8DC9EF, #4E9FD1);
		background: -moz-linear-gradient(top, #8DC9EF, #4E9FD1);
		background: linear-gradient(top, #8DC9EF, #4E9FD1);
		background: -ms-linear-gradient(top, #8DC9EF, #4E9FD1);
	}
	.findBtn, .findBtn1, .findBtn2 {
		background: #427dff, background;
		border-radius: 50px;
		background: -webkit-linear-gradient(top, #57a0ff, #57a1ff);
		background: -moz-linear-gradient(top, #57a0ff, #57a1ff);
		background: linear-gradient(top, #57a0ff, #57a1ff);
		background: -ms-linear-gradient(top, #57a0ff, #57a1ff);
		border: 1px solid #2576A8;
		box-shadow: 0 1px 2px #8AC1E2 inset, 0 -1px 0 #57a0ff inset;
		color: #fff;
		height: 40px;
		text-shadow: 1px 1px 0.5px #57a0ff;
		outline: none;
		margin-left: 100px;
	}
</style>
<body style="background: #f5f5f5;padding: 0 10px;">

		    <div id="modal-overlay">
			    
			</div>
			<div class="modal-data">
				<div style="height: 60px">
				 <ul>
				  	<li  style="text-align: left;margin-left: 60px;height: 40px;line-height: 40px">
				  		<span>名称：</span>
				  		<span>
				  		 	<input class="name" type="text" >
				  		</span>
				  		<span>
				  			<button class="findBtn">
				  				查询
				  			</button>
				  		</span>
				  	</li>
				 </ul>
				</div>
				<div style="width:100%; height:350px; overflow:scroll;">
			      <form action="">
			        <table width="100%" class="head" style="width: auto;white-space:nowrap;border-spacing: 0px">
			        <tr style="background: #f2f2f2;height: 30px;line-height: 20px;" class="sel">
			        <td style="width: 20px"></td>
			        <td>
			        	名称
			        </td>
			        <td>
			        	编码
			        </td>
			        <td>
			        	简称
			        </td>
			        <td>
			        	描述
			        </td>
			        <td>
			        	创建时间
			        </td>
			        <td>
			        	用户名
			        </td>
			        <td>
			        	最后修改时间
			        </td>
			        <td>
			        	用户名
			        </td>
			        <td>
			        	财务组织
			        </td>
			        <td>
			        	金额
			        </td>
			        </tr>
			        	<c:forEach items="${fillingCards}" var="fillingCard" >
			        	<tr style="margin-top: 45px" class="fuelCard">
			        		<td>
			        		 <input style="width: 15px;height: 15px" type="checkbox" name="card"  value="${fillingCard.fid}">
			        		</td>
			        		<td>${fillingCard.fnameL2}</td>
			        		<td>${fillingCard.fnumber}</td>
			        		<td>${fillingCard.fsimplename}</td>
			        		<td>${fillingCard.fdescriptionL2}</td>	
			        		<td>${fillingCard.fcreatetime}</td>	
			        		<td>${fillingCard.createName}</td>	
			        		<td>${fillingCard.flastupdatetime}</td>	
			        		<td>${fillingCard.updateName}</td>	
			        		<td>${fillingCard.cfficompanyName}</td>	
			        		<td>${fillingCard.cfamount}</td>	
			        	</tr>
			        	</c:forEach>
			        </table>
			      </form>
					<button class="subtn"
							style="width: 150px;position: absolute;bottom: 25px;font-size: 16px;left: 280px">
			      	确定
			      </button>
					<button class="btn"
							style="width: 150px;position: absolute;bottom: 25px;font-size: 16px;right: 280px">
			      	关闭
			      </button>
			</div>
			</div>
		<div class="place" style="background: #f5f5f5;margin-top: 10px">
			<ul class="placeul">
				<li><a href="#">报表</a></li>
				<li><a href="#">加油卡统计报表</a></li>
			</ul>
		</div>
	
		<div class="rightinfo" style="background: #fff;border-radius:10px;min-height: 45px;float: left;margin-bottom: 20px;width:99.1%">

			<form action="<%=path%>/DrivingSys/selFuelCardJournal" method="post">
				<ul class="seachform" >
					    <li><label>驾校</label><input name="carFnumber" id="car" type="text" disabled="disabled" class="scinput" value="${company}"/>
					  
					    </li>
					    <li><label>加油卡</label>
					    <input  id="card"  type="text" name="fname" class="scinput" value="${fname}"/>
					    <input type="hidden" name="fid" id="fid" value="${fid}">
					    </li>
					   <li><label>开始时间</label><input class="scinput1"  name="beginTime" type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}',dateFmt:'yyyy-MM-dd'})" 
					    id="datemin" class="input-text Wdate"  value="${beginTime}"></li>
						<li><label>结束时间</label><input class="scinput1"  name="endTime" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd'})" 
						id="datemax" class="input-text Wdate" value="${endTime}"></li>		
						<li><label>&nbsp;</label>
							<input name="" type="submit"  style="outline: none;" class="scbtn" value="立即查询" />

						</li>
					<shiro:hasPermission name="/selFuelCardJournal">
							<li style="height: 40px;text-align: left;color: #999999;">
								<label>&nbsp;</label>
								   &nbsp;<input  type="button"  id="submitExcel" value="导出EXCLE" class="scbtn" >
							</li>
					</shiro:hasPermission>
				</ul>
			
			</form>
		</div>
		
		
		<div style="width: 100%;overflow:auto;margin-bottom: 0px;margin-top: 30px;background: #fff;border-radius:10px;min-height:600px">
		<form id="excel" action="<%=path%>/DrivingSys/outXls" method="post">
			<div  class="success">
						<div style="min-height: 240px;width: 85%;padding-left: 20px;padding-top: 20px;">
								<table  width="100%" align="center"  style="border-collapse:collapse;min-height:30px;border-spacing:0;">
									<tr >
										<td style="width: 5px;height: 50px;background: rgb(228,234,254);"></td>
										<td style="width: 27px;height: 50px;background: rgb(228,234,254);"  align="center">业务类型</td>
										<td style="width: 22px;height: 50px;background: rgb(228,234,254);" align="center">车辆</td>
										<td style="width: 23px;height: 50px;background: rgb(228,234,254);" align="center">金额</td>
										<td style="width: 24px;height: 50px;background: rgb(228,234,254);" align="center">数量（公升）</td>
										<td style="width: 25px;height: 50px;background: rgb(228,234,254);" align="center">业务日期</td>
										<td style="width: 30px;background: rgb(228,234,254);" align="center">备注</td>
									</tr>
									<tr>
										<td width="20px" rowspan="2"></td>
										<td style="width: 20px;" rowspan="2" align="center">期初</td>
										<td style="width: 20px;" align="center"></td>
										<td style="width: 20px;" align="center">${beginBalance}</td>
										<td style="width: 20px;" align="center">0</td>
										<td style="width: 20px;" align="center">${beginTime}</td>
										<td style="width: 20px;" align="center"></td>
									</tr>
									
									<tr>
										<td style="width: 20px;background: rgb(154,219,156);" align="center">小计</td>
										<td style="font-weight: 800;width: 20px;background: rgb(154,219,156);" align="center">${beginBalance}</td>
										<td style="width: 20px;background: rgb(154,219,156);" align="center">0</td>
										<td style="width: 20px;background: rgb(154,219,156);" align="center"></td>
										<td style="width: 20px;background: rgb(154,219,156);" align="center"></td>
									</tr>
									<tr >
										<td style="width: 10px;"></td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center">小计</td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
										<td style="font-weight: 800;width: 20px;background: rgb(250,255,195);" align="center">${beginBalance}</td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center">0</td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
									</tr>
									<tbody id="table1" style="border-spacing: 0px">
									<c:forEach items="${fillingCardRecharges}" var="fillingCardRecharge"> 
									<tr style="border-left: 1px solid #c7c7c7;" >
										<td width="20px"></td>
										<td style="width: 20px;" align="center">充值</td>
										<td style="width: 20px;" align="center">充值</td>
										<td style="width: 20px;" align="center">${fillingCardRecharge.cfamount}</td>
										<td style="width: 20px;" align="center">0</td>
										<td style="width: 20px;" align="center">${fillingCardRecharge.fbizdate}</td>
										<td style="width: 20px;" align="center">${fillingCardRecharge.fdescription}</td>
									</tr>
									</c:forEach>
									</tbody>
									<tr>
										<td style="width: 5px;" width="20px"></td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center">小计</td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
										<td class="fillingBeginBalance" style="font-weight: 800;width: 20px;background: rgb(250,255,195);" align="center">${fillingBeginBalances}</td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center">0</td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
									</tr>
									
									<tbody id="table2">
									<c:forEach items="${cardRegEntries}" var="cardRegEntrie"> 
									<tr>
										<td width="20px"></td>
										<td style="width: 20px;" align="center">车辆加油</td>
										<td style="width: 20px;" align="center">${cardRegEntrie.cfcarName}</td>
										<td style="width: 20px;" align="center">${cardRegEntrie.cfamount}</td>
										<td style="width: 20px;" align="center">${cardRegEntrie.cfqty}</td>
										<td style="width: 20px;" align="center">${cardRegEntrie.fbizdate}</td>
										<td style="width: 20px;" align="center">${cardRegEntrie.cfdesc}</td>
									</tr>
									</c:forEach>				
									</tbody>
									<tfoot></tfoot>	
									<tbody id="table3" style="border-spacing: 0px">
									<tr>
										<td style="width: 5px;"></td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center">小计</td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
										<td style="font-weight: 800;width: 20px;background: rgb(250,255,195);" align="center">${reflueBeginBalances}</td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center">${cfamout}</td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
									</tr>
									<tr>
										<td width="20px" rowspan="2"></td>
										<td style="width: 20px;" rowspan="2" align="center">期末</td>
										<td style="width: 20px;" align="center"></td>
										<td style="width: 20px;" align="center">${endBalance}</td>
										<td style="width: 20px;" align="center"></td>
										<td style="width: 20px;" align="center">${endTime}</td>
										<td style="width: 20px;" align="center"></td>
									</tr>
									<tr>
										<td style="width: 20px;background: rgb(154,219,156);" align="center">小计</td>
										<td style="font-weight: 800;width: 20px;background: rgb(154,219,156);" align="center">${endBalance}</td>
										<td style="width: 20px;background: rgb(154,219,156);" align="center"></td>
										<td style="width: 20px;background: rgb(154,219,156);" align="center"></td>
										<td style="width: 20px;background: rgb(154,219,156);" align="center"></td>
									</tr>
									<tr>
										<td style="width: 5px;background: rgb(250,255,195);"></td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center">小计</td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
										<td style="font-weight: 800;width: 20px;background: rgb(250,255,195);" align="center">${endBalance}</td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
										<td style="width: 20px;background: rgb(250,255,195);" align="center"></td>
									</tr>
									</tbody>
								</table>
						</div>
				</div>		
				
                <input id="xls" type="hidden" name="xls" value="">
                <input type="hidden" name="fileNames" value="加油卡统计报表">
			</form>
			</div>
		
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<script type="text/javascript">

    $('.fuelCard').live('dblclick',function(){
        $('#fid').val($(this).find('input').val())
        $('#card').val($(this).find('td:nth-child(2)').html())
        $('#modal-overlay').css('visibility','hidden')
        $('.modal-data').css('visibility','hidden')
        $('input:checkbox').removeAttr('checked');
    })


	$('#submitExcel').live('click',function () {
		$('#excel').submit()
    })

		$(document).ready(function(){

            //单击选中复选框
            $("tr").live('click',function(){
                var check = $(this).find("input[type='checkbox']");
                if(check){
                    var flag = check[0].checked;
                    if(flag){
                        check[0].checked = false;
                    }else{
                        check[0].checked = true;
                    }
                }
                $("tr input[type='checkbox']").attr("checked", false);
                $(this).find("input[type='checkbox']").attr("checked", true);
            });

            //阻止复选框进行冒泡事件
            $("tr input[type='checkbox']").live('click',function(e){
                e.stopPropagation();
            });

			_w_table_rowspan("#table2","3",'1')
			
			
			_w_table_rowspan("#table2","2",'0') 
			
			
			_w_table_rowspan2("#table1","3",'0')
			
			
			_w_table_rowspan2("#table1","2",'1')
			
			
			function _w_table_rowspan(_w_table_id ,_w_table_colnum,flag){   
				   
				flag = flag
				length = $(_w_table_id).find('tr').length
			    _w_table_firsttd = "";     
			    _w_table_currenttd = "";     
			    _w_table_SpanNum = 0;     
			    _w_table_totalCount = 0;    //小计数量
			    _w_table_totalPrice = 0;	//小计价格
			    _w_table_Obj = $(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")");     
			    _w_table_Obj.each(function(i){  
			        if(i==0){     
			            _w_table_firsttd = $(this);     
			            _w_table_SpanNum = 1;  
			            _w_table_totalPrice = _w_table_firsttd.next().text()-0;
			            _w_table_totalCount = _w_table_firsttd.next().next().text()-0;
			         
			        }else{     
			            _w_table_currenttd = $(this); 
			            if(_w_table_SpanNum == 1){
			        		_w_table_totalPrice = _w_table_firsttd.next().text()-0;	
			        		_w_table_totalCount = _w_table_firsttd.next().next().text()-0; 		  
			        	}
			            if(_w_table_firsttd.text()==_w_table_currenttd.text()){     
			                _w_table_SpanNum++;     
			                if(flag == 1){
							      _w_table_totalPrice = _w_table_totalPrice + (_w_table_currenttd.next().text()-0)
							      _w_table_totalCount = _w_table_totalCount + (_w_table_currenttd.next().next().text()-0)
							      /* alert(_w_table_totalPrice) */
							      if(i == length-1){          //最后一个
							    	 str = '<tr><td style="width: 20px;" align="center"></td>'
									  str += '<td style="width: 20px;background: rgb(154,219,156);" align="center">车辆加油</td> <td style="width: 20px;background: rgb(154,219,156);" align="center">小计'
									    str += '</td> <td style="font-weight: 800;width: 20px;background: rgb(154,219,156);" align="center">'+_w_table_totalPrice+'</td><td style="font-weight: 800;width: 20px;background: rgb(154,219,156);" align="center">'+_w_table_totalCount+'</td>'
										  str += '<td style="width: 20px;background: rgb(154,219,156);" align="center"> '
									        str += '</td><td style="width: 20px;background: rgb(154,219,156);" align="center"></td> </tr>'
								  _w_table_firsttd.attr("rowSpan",_w_table_SpanNum-0+1);
								  $(_w_table_id).append(str)
							      }
							      
							 }
				           
			                _w_table_currenttd.remove();    //remove();  
			                _w_table_firsttd.attr("rowSpan",_w_table_SpanNum);   
			            }
			            else{     	
			            	   _w_table_totalCount = _w_table_totalCount.toFixed(2)
			            	   _w_table_totalPrice = _w_table_totalPrice.toFixed(2)
			            	  str = '<tr><td style="width: 20px;" align="center"></td>'
							  str += '<td style="width: 20px;background: rgb(154,219,156);" align="center">车辆加油</td> <td style="width: 20px;background: rgb(154,219,156);" align="center">小计'
							  str += '</td> <td style="font-weight: 800;width: 20px;background: rgb(154,219,156);" align="center">'+_w_table_totalPrice+'</td><td style="font-weight: 800;width: 20px;background: rgb(154,219,156);" align="center">'+_w_table_totalCount+'</td>'
							  str += '<td style="width: 20px;background: rgb(154,219,156);" align="center"> '
						      str += '</td><td style="width: 20px;background: rgb(154,219,156);" align="center"></td> </tr>'
						       _w_table_currenttd.parent().prev().after(str)	
			            	   _w_table_totalCount = 0;
			            	   _w_table_totalPrice = 0 
			               	   _w_table_firsttd = $(this);     
			               	   _w_table_SpanNum = 1;   
			            }     
			        }
			        

			    });     
			    
			}     

			
			function _w_table_rowspan2(_w_table_id ,_w_table_colnum,flag){ 
			  var fillingBeginBalance =	$('.fillingBeginBalance').html()
				var str = '<tr><td style="width: 20px;" align="center"></td>'
				    str += '<td style="width: 20px;background: rgb(154,219,156);" align="center">小计</td> <td style="font-weight: 800;width: 20px;background: rgb(154,219,156);" align="center">'
				    str += ''+fillingBeginBalance+'</td> <td style="width: 20px;background: rgb(154,219,156);" align="center">0</td><td style="width: 20px;background: rgb(154,219,156);" align="center"></td> <td style="width: 20px;background: rgb(154,219,156);" align="center"> '
					str += '</td></tr>'
			    _w_table_firsttd = "";     
			    _w_table_currenttd = "";     
			    _w_table_SpanNum = 0;     
			    _w_table_Obj = $(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")");     
			    _w_table_Obj.each(function(i){     
			        if(i==0){     
			            _w_table_firsttd = $(this);     
			            _w_table_SpanNum = 1;   			            
			        }else{     
			            _w_table_currenttd = $(this);     
			            if(_w_table_firsttd.text()==_w_table_currenttd.text()){     
			                _w_table_SpanNum++;     
			                _w_table_currenttd.remove(); 
			                
			                _w_table_firsttd.attr("rowSpan",_w_table_SpanNum);  
			            }else{     
			                _w_table_firsttd = $(this);     
			                _w_table_SpanNum = 1;   
			               
			            }     
			        }
			        
			    });     
				  /*if(flag == 1){
						_w_table_firsttd.attr("rowSpan",_w_table_SpanNum-0+1);
						$(_w_table_id).append(str)
					}*/
			    
			}     
			
			
			$('.state').val($('.cfbilltype').val()-0-1)
			
			$('#xls').val($('.success').html());
			
	
		})
			
	 
  
		
		$('#exportExcle').live('click',function(){
			location.href='<%=path%>/DrivingSys/exportExamOrderMassExcle'		
		})

		$('.input_back').click(function(){
			location.href='<%=path%>/DrivingSys/chooseFuelCardJournal'		
		})

	
		
		  
	 $('#card').live('click',function(){
		   $('#modal-overlay').css('visibility','visible')
			$('.modal-data').css('visibility','visible')
	   })
	   
	   $('.btn').click(function(){
		$('#modal-overlay').css('visibility','hidden')
		$('.modal-data').css('visibility','hidden')
		$('input:checkbox').removeAttr('checked');
		})
	
	$('.subtn').click(function(){
		  var spCodesTemp = "";
	      $('input:checkbox[name=card]:checked').each(function(i){
	       if(0==i){
	        spCodesTemp = $(this).val();
	       }else{
	        spCodesTemp += (","+$(this).val());
	       }
	      });
	      spCodesTemp = spCodesTemp.split(",")
	      $.ajax({
			    url:'<%=path%>/DrivingSys/selFuelCardJournalById', 
			    type: "post",
			    data:{'fid':spCodesTemp[0]},
			    dataType:"json",         	
			    success: function(json) {
			    	 $('#modal-overlay').css('visibility','hidden')
					 $('.modal-data').css('visibility','hidden')
	           		 $('#card').val(json.fnameL2)
	           		 $('#fid').val(json.fid)
				},  
				error: function(){alert('Error');} 
	 			});

	})
	
	$('.findBtn').click(function(){
	 var name=$('.name').val()
		 $.ajax({
			    url:'<%=path%>/DrivingSys/selFuelCardJournalByName', 
			    type: "post",
			    data:{'name':name},
			    dataType:"json",         	
			    success: function(json) {
	            var str=''
	            for(var i=0;i<json.length;i++) {
	               str+='<tr style="margin-top: 45px" ><td><input style="width: 15px;height: 15px" '
	               str+='type="checkbox" name="card"  value="'+json[i].fid+'"></td>'
	               if( json[i].fnumber != null){
	        	   str+='<td>'+json[i].fnameL2+'</td><td>'+json[i].fnumber+'</td>'
	               }else{
	            	str+='<td>'+json[i].fnameL2+'</td><td></td>'  
	               }
	               if(json[i].fsimplename!=null){
	            	str+='<td>'+json[i].fsimplename+'</td>'	
	               }else{
	                str+='<td></td>'   
	               }
	               if(json[i].fdescriptionL2!=null){
		            	str+='<td>'+json[i].fdescriptionL2+'</td><td>'+json[i].fcreatetime+'</td>'	
		               }else{
		                str+='<td></td><td>'+json[i].fcreatetime+'</td>'   
		               }
	               if(json[i].createName == null) {
	            	   str+='<td></td><td>'+json[i].flastupdatetime+'</td>'
	               }else{
	            	   str+='<td>'+json[i].createName+'</td><td>'+json[i].flastupdatetime+'</td>'
	               }            
	               str+='<td>'+json[i].updateName+'</td><td>'+json[i].cfficompanyName+'</td>'
	               str+='<td>'+json[i].cfamount+'</td>'
	            }
	            $(".head tr:not(':first')").remove()
	            $('.head').append(str)
				},  
 				error: function(){alert('Error');} 
 	 			});
		
	})		


</script>
</html>